<template>
  <n-space :vertical="true">
    <n-divider class="!mb-0 text-14px text-[#666]">测试账号快捷登录</n-divider>
    <n-space justify="center">
      <n-button
        v-for="item in accounts"
        :key="item.phone"
        type="primary"
        @click="login(item.phone, item.password, item.organizationId)"
      >
        {{ item.label }}
      </n-button>
    </n-space>
  </n-space>
</template>

<script lang="ts" setup>
interface Emits {
  (e: 'login', param: { phone: string; password: string; organizationId: string }): void;
}

const emit = defineEmits<Emits>();

const accounts = [
  {
    label: '超管',
    phone: '15987654321',
    password: 'super123',
    organizationId: '1'
  },
  {
    label: '管理员',
    phone: '15987654322',
    password: 'admin123',
    organizationId: '1'
  },
  {
    label: '供应商',
    phone: '15987654323',
    password: 'user123',
    organizationId: '2'
  }
];

function login(phone: string, password: string, organizationId: string) {
  emit('login', { phone, password, organizationId });
}
</script>

<style scoped></style>
